/**
 * Created by zhao on 17-1-30.
 */
function readNews(id) {
    location.href = "/news/read.do?id="+id;
}
function addMedia($target,$news) {
    var $data = $("<div class='media' onclick='readNews("+$news.id+")'>" +
        "<div class='media-body' >" +
        "<div><h4 class='media-heading'>"+ $news.title+"</h4></div>"+
        "<div style='padding-top: 10px'><small style='padding-top: 10px'>"+$news.intrduce+"</small></div>" +
        "</div>" +
        "<div class='media-right'>" +
        "<a href='/news/read.do?id="+ $news.id+"'/>" +
        "<img class='media-object' style='padding-top:10px;max-height:100px;max-width: 100px;' src='"+$news.thumbnailPath+"' />"
        +"</a></div></div>");
    $target.append($data);
}

function initNav() {
    $.ajax("/module/moduleJson.do",{
        success:function (data) {
            for (var i=0;i<data.length;i++){
                $li = $("<li><a href='/module/selectModule.do?id="+data[i].id+"'>"+data[i].name+"</a></li>");
                $("#nav-ul").append($li);
            }
        }
    })
}

